//
// Created by 张兮兮 on 2025/3/13.
//

#ifndef TEMP_WORKERWIDGET_H
#define TEMP_WORKERWIDGET_H

#include <QWidget>
#include <QDebug>
#include "Worker.h"
#include <QTimer>
#include <QPushButton>

class WorkerWidget : public QWidget {
Q_OBJECT
public:
    WorkerWidget(QWidget *parent = nullptr);

    ~WorkerWidget();

    QImage image;
    Worker *worker = nullptr;
    QThread workerThread;
    QTimer timer;
    QPushButton *button;
    QImage currentFrame;
protected:
    void paintEvent(QPaintEvent *event) override;
signals:
    void stopWorker();
    void initWorker();
    void sendImageToWorker(const QImage &image);

private slots:
    void onWorkerStopped();
    void onButtonClicked();  // 释放线程
    void sendImage();  // 发送图片
    void handleResult(const QString &result);  // 处理结果
};


#endif //TEMP_WORKERWIDGET_H
